package cn.shu.Singleton;

import cn.shu.Factory.Car;

/**
 *
 * 静态内部类的方式创建单例模式
 * Created by 76062 on 2017/9/22.
 */
public class FactoryManager {
    
    private static class SmsSingleFactory{

        static final SmsFactory instance = new SmsFactory();
        public static SmsFactory getInstance() {
            return instance;
        }
    }
    
    private static class EmailSingleFactory{

        static final EmailFactory instance = new EmailFactory();
        public static EmailFactory getInstance() {
            return instance;
        }
    }

    public static EmailFactory getEmailInstance() {
        return EmailSingleFactory.getInstance();
    }

    public static SmsFactory getSmsInstance() {
        return SmsSingleFactory.getInstance();
    }
}
